package ynu.edu.merchant.dto;

import jakarta.validation.constraints.*;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 商家DTO
 */
@Data
public class MerchantDTO {

    private Long id;

    @NotBlank(message = "用户名不能为空", groups = {Create.class})
    @Size(min = 4, max = 20, message = "用户名长度必须在4-20个字符之间", groups = {Create.class})
    private String username;

    @NotBlank(message = "密码不能为空", groups = {Create.class})
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间", groups = {Create.class})
    private String password;

    @NotBlank(message = "商家名称不能为空")
    @Size(min = 2, max = 50, message = "商家名称长度必须在2-50个字符之间")
    private String name;

    @NotBlank(message = "商家地址不能为空")
    @Size(max = 200, message = "地址长度不能超过200个字符")
    private String address;

    @NotBlank(message = "商家电话不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$|^0\\d{2,3}-?\\d{7,8}$", message = "电话格式不正确")
    private String phone;

    @Size(max = 500, message = "描述长度不能超过500个字符")
    private String description;

    private String image;

    @DecimalMin(value = "0.0", message = "评分不能小于0")
    @DecimalMax(value = "5.0", message = "评分不能大于5")
    private BigDecimal rating;

    @Size(max = 100, message = "营业时间长度不能超过100个字符")
    private String businessHours;

    @DecimalMin(value = "0.0", message = "配送费不能小于0")
    private BigDecimal deliveryFee;

    @DecimalMin(value = "0.0", message = "起送价不能小于0")
    private BigDecimal minOrderAmount;

    private Long categoryId;

    @Min(value = 0, message = "状态值不正确")
    @Max(value = 1, message = "状态值不正确")
    private Integer status;

    @Min(value = 0, message = "月销量不能为负数")
    private Integer monthlySales;
    
    /**
     * 创建商家时的验证分组
     */
    public interface Create {}
} 